#conventional standard errors
doc_mod_indo <- lm(prop_doctors ~ log10(pop) + pop_growth + density + div_index + avg_income + elec_comp_index, data = indonesia_data)
teach_mod_indo <- lm(teachers_prop ~ log10(pop) + pop_growth + density + div_index + avg_income + elec_comp_index, data = indonesia_data)
comm_mod_indo <- lm(prop_comm_health ~ log10(pop) + pop_growth + density + div_index + avg_income + elec_comp_index, data = indonesia_data)
schools_mod_indo <- lm(schools_prop ~ log10(pop) + pop_growth + density + div_index + avg_income + elec_comp_index, data = indonesia_data)
elec_mod_indo <- lm(prop_govt_electricity ~ log10(pop) + pop_growth + density + div_index + avg_income + elec_comp_index, data = indonesia_data)
water_mod_indo <- lm(prop_water ~ log10(pop) + pop_growth + density + div_index + avg_income + elec_comp_index, data = indonesia_data)

table <- list(comm_mod_indo, schools_mod_indo, doc_mod_indo, teach_mod_indo, elec_mod_indo, water_mod_indo)

table <- stargazer(table,
                   label = 'tab:indo1',
                   type = "html",
                   title = "Relationship Between City Size and Public Goods, Indonesia",
                   dep.var.labels = c("Health Centers", "Schools", "Doctors", "Teachers", "Electricity", "Water"),
                   covariate.labels = c("City Size (log(population))", "Growth (2001-2011)",
                                        "Density (1000/km2)", "Religious Diversity Index", "Average income",
                                        "Electoral competition index"),
                   star.cutoffs = c(0.05, 0.01, 0.001),
                   keep.stat = c("n"),
                   digits = 2,
                   notes = NULL,
                   add.lines = list(c("Cluster SE?", rep("No", 6)))
)

cat(table, sep = '\n', file = "./_4_outputs/table_a1.htm")

#clean up
rm(table, comm_mod_indo, schools_mod_indo, doc_mod_indo, elec_mod_indo, water_mod_indo)